package com.lonely.fx.property_change_support;

import java.beans.PropertyChangeSupport;

/**
 * @date: 2022-07-21 14:33
 * @author: ztkj-hzb
 * @description:
 **/
public class User {

    /**
     * 用户名
     */
    private String name;

    /**
     * 密码
     */
    private Integer age;

    /**
     * 属性变化监听器
     */
    public final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    public String getName() {
        return name;
    }

    public User setName(String name) {
        propertyChangeSupport.firePropertyChange("name",this.name,name);
        this.name = name;
        return this;
    }

    public Integer getAge() {
        return age;
    }

    public User setAge(Integer age) {
        propertyChangeSupport.firePropertyChange("age",this.age,age);
        this.age = age;
        return this;
    }
}
